package com.linln.admin.system.web;

import com.github.pagehelper.Page;
import com.linln.common.utils.HttpServletUtil;
import com.linln.modules.system.entity.WxUser;
import com.linln.modules.system.service.WxUserServices;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

@Controller
@RequestMapping(value = "/mains/user")
public class WxUserController extends BaseController{

    @Autowired
    private WxUserServices wxUserServices;

    @RequestMapping(value = "/index")
    @RequiresPermissions("mains:user:index")
    public ModelAndView getIndex(Integer pageNum) {
        Integer pageIndex = HttpServletUtil.getParameterInt("size", 1);

        pageNum = pageNum == null ? super.pageNum : pageNum;
        ModelAndView view = new ModelAndView();
        view.setViewName("/mains/user/index");
        Page<WxUser> company = wxUserServices.getIndexWxUser(pageNum, pageIndex*10, null);
        view.addObject("list", company.getResult());
        view.addObject("page", company);
        return view;
    }
}
